package com.ysd.twocrm.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ysd.twocrm.entity.Student;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public interface StudentMapper extends BaseMapper<Student> {

    <E extends IPage<Student>> E findAllStudent(E page, @Param("ew") Wrapper<Student> queryWrapper);//多条件分页查询

    @Select("select * from student where studentNo =#{studentNo}")
     Student getIfStuNo(String studentNo);//根据学号来查询学生是否存在
    @Delete(value = "delete from student where stuClassId=#{stuClassid}")
    Integer delStudentByStuClassId(Integer stuClassid);//根据班级来删除班级下的全部学生
    @Select(value = "select * from student where exit1=#{exit1}")
    Student findStudentByUserId(Integer exit1);
    @Select(value = "select exit1 from student where stuclassid in(select stuclassid from studentclass where stuclassistid=#{userId})")
    List<Student> findAllStudentExit1ByUserId(Integer userId);
}
